/*jslint node:true*/
'use strict';

var events = require('events');
var eventEmitter = new events.EventEmitter();

var connectHandler = function connect() {
    console.log('连接成功');
    
    eventEmitter.emit('data_received');
};

eventEmitter.on('connection', connectHandler);

eventEmitter.on('data_received', function () {
    console.log('数据接收成功');
});

eventEmitter.emit('connection');

console.log('程序执行完毕');